initial commit
[clinton/prusa3.git] / old stuff / frame-vertex.scad
CommitLineData
d3618a65
NZ
1// Thanks for awesome Greg Frosts curves :-)
2
3// PRUSA Mendel
4// Frame vertex
5// GNU GPL v3
6// Greg Frost
7// http://www.reprap.org/wiki/Prusa_Mendel
8// http://github.com/prusajr/PrusaMendel
9
10
11include <configuration.scad>
12basefoot=true;
13
14vertex(with_foot=basefoot);
15
16%import_stl("frame-vertex.stl");
17
18//teardrop();
19
20module teardrop (r=8,h=20)
21{
22 rotate([-270,0,90])
23 linear_extrude(height=h)
24 {
25 circle(r=r);
26 polygon(points=[[0,0],[r*cos(30),r*sin(30)],[0.5*r,r],[-0.5*r,r],[-r*cos(30),r*sin(30)]],
27 paths=[[0,1,2,3,4]]);
28 }
29}
30
31
32
33vfvertex_height=threaded_rod_diameter+4.5;
34
35/**
36 * @id frame-vertex
37 * @name Frame vertex
38 * @category Printed
39 * @id frame-vertex
40 * @using 8 m8nut
41 * @using 8 m8washer
42 */
43/**
44 * @id frame-vertex-foot
45 * @name Frame vertex with foot
46 * @category Printed
47 * @id frame-vertex-foot
48 * @using 8 m8nut
49 * @using 8 m8washer
50 */
51
52hole_separation=58.5;
53vertex_end_major_d=30.15;
54vertex_end_minor_d=18.5;
55vertex_horizontal_hole_offset=11.75;
56hole_flat_radius=8.5; // flat surface around holes.
57foot_depth=26.25;
58end_round_translation=vertex_horizontal_hole_offset-hole_flat_radius;
59
60
61
62
63module vertex(with_foot=basefoot)
64{
65 peg_r=12;
66 peg1=[hole_separation+vertex_end_major_d/2-peg_r,
67 vertex_horizontal_hole_offset+hole_flat_radius];
68 peg2=rotate_vec([hole_separation+vertex_end_major_d/2-peg_r,
69 -vertex_horizontal_hole_offset-hole_flat_radius],60);
70
71 inner_peg_r=12;
72 peg3=[hole_separation-vertex_end_major_d/2+inner_peg_r,
73 vertex_horizontal_hole_offset+hole_flat_radius];
74 peg4=rotate_vec([hole_separation-vertex_end_major_d/2+inner_peg_r,
75 -vertex_horizontal_hole_offset-hole_flat_radius],60);
76
77 a1_r=11;
78 a2_r=11;
79 a3_r=3;
80 a4_r=3;
81
82 a1=[hole_separation-vertex_end_major_d/2+a1_r,
83 vertex_horizontal_hole_offset-hole_flat_radius];
84 a2=[hole_separation+vertex_end_major_d/2-a2_r,
85 vertex_horizontal_hole_offset-hole_flat_radius];
86 a3=[hole_separation-vertex_end_major_d/2+a1_r,-foot_depth+a3_r];
87 a4=[hole_separation+vertex_end_major_d/2-a2_r,-foot_depth+a4_r];
88
89// translate([-hole_separation-vertex_end_major_d/2,-vertex_horizontal_hole_offset,-vfvertex_height/2])
90 translate([-18.5,9,0])
91 difference ()
92 {
93 union ()
94 {
95 for (hole=[(with_foot?1:0):1])
96 rotate(hole*60)
97 translate([hole_separation,end_round_translation-hole*2*end_round_translation,0])
98 scale([1,(vertex_end_minor_d+2*end_round_translation)/vertex_end_major_d,1])
99 cylinder(r=vertex_end_major_d/2,h=vfvertex_height);
100
101 for (block=[0:1])
102 rotate(block*60)
103 translate([hole_separation,
104 vertex_horizontal_hole_offset-block*2*vertex_horizontal_hole_offset,
105 vfvertex_height/2])
106 cube([vertex_end_major_d,
107 2*hole_flat_radius,vfvertex_height],center=true);
108
109 linear_extrude(height=vfvertex_height)
110 {
111 // The outer curve.
112 barbell(peg1,peg2,peg_r,peg_r,200,30);
113 // The inner curve.
114 barbell(peg3,peg4,inner_peg_r,inner_peg_r,20,200);
115
116 if (with_foot)
117 {
118 // Curves for the feet
119 barbell(a1,a3,a1_r,a3_r,200,20);
120 barbell(a2,a4,a2_r,a4_r,20,200);
121
122 // The flat bit on the bottom of the foot.
123 polygon(points=[a3+[0,-a3_r],a4+[0,-a4_r],(a3+a4)/2+[0,5]],
124 paths=[[0,1,2]]);
125 }
126 }
127 }
128
129 for (hole=[0:1])
130 rotate(hole*60)
131 translate([hole_separation,0,-1])
132 cylinder(h=vfvertex_height+2,r=(threaded_rod_diameter/2));
133
134 for (block=[0:1])
135 rotate(block*60)
136 translate([hole_separation-vertex_end_major_d/2-1,
137 vertex_horizontal_hole_offset-2*block*vertex_horizontal_hole_offset,
138 vfvertex_height/2])
139 teardrop(r=threaded_rod_diameter/2,h=vertex_end_major_d+2);
140 if (with_foot){
141 translate([31+18.5,20-9,vfvertex_height]) linear_extrude(file = "this-way-up.dxf", layer = "0",
142 height = 2, center = true, convexity = 10, twist = -fanrot);
143 translate([31+18.5,20-9,0]) linear_extrude(file = "this-way-up.dxf", layer = "0",
144 height = 2, center = true, convexity = 10, twist = -fanrot);
145 }else{
146 translate([31+18.5+15,20-9+16.5,vfvertex_height]) rotate([0,0,30+90]) linear_extrude(file = "this-way-up.dxf", layer = "0",
147 height = 2, center = true, convexity = 10, twist = -fanrot);
148 translate([31+18.5+15,20-9+16.5,0]) rotate([0,0,30+90]) linear_extrude(file = "this-way-up.dxf", layer = "0",
149 height = 2, center = true, convexity = 10, twist = -fanrot);
150 }
151 }
152}
153
154module barbell (x1,x2,r1,r2,r3,r4)
155{
156 x3=triangulate (x1,x2,r1+r3,r2+r3);
157 x4=triangulate (x2,x1,r2+r4,r1+r4);
158 render()
159 difference ()
160 {
161 union()
162 {
163 translate(x1)
164 circle (r=r1);
165 translate(x2)
166 circle(r=r2);
167 polygon (points=[x1,x3,x2,x4]);
168 }
169 translate(x3)
170 circle(r=r3,$fa=5);
171 translate(x4)
172 circle(r=r4,$fa=5);
173 }
174}
175
176function triangulate (point1, point2, length1, length2) =
177point1 +
178length1*rotated(
179atan2(point2[1]-point1[1],point2[0]-point1[0])+
180angle(distance(point1,point2),length1,length2));
181
182function distance(point1,point2)=
183sqrt((point1[0]-point2[0])*(point1[0]-point2[0])+
184(point1[1]-point2[1])*(point1[1]-point2[1]));
185
186function angle(a,b,c) = acos((a*a+b*b-c*c)/(2*a*b));
187
188function rotated(a)=[cos(a),sin(a),0];
189function rotate_vec(v,a)=[cos(a)*v[0]-sin(a)*v[1],sin(a)*v[0]+cos(a)*v[1]];